package com.qf.aop_aspect;

import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Pointcut;
import org.springframework.stereotype.Component;

import java.util.Queue;

/*
@author fu
@date 2022/3/2321:25
自定义一个切面,将所有的增强的方法自定义出来
*/
@Aspect
@Component
public class MyAspect {

    @Pointcut("execution(* *.*.service.impl.*.*(..))")
    public void pt(){};//pt就是切点表达式

    @Around("pt()")
    public Object myRound(ProceedingJoinPoint joinPoint){
        Object target = null;
        try{
            System.out.println("权限处理....");
            //执行业务方法
            target = joinPoint.proceed();
            System.out.println("产生日志....");
        }catch (Throwable throwable){
            throwable.printStackTrace();
            System.out.println("异常打印...");
        }finally {
            System.out.println("after最终,通知");
        }
        return null;
    }
}
